package com.huanzhu.asuper.supervisionapp.cjbjdudao;

import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.content.res.AssetManager;
import android.net.Uri;
import android.os.Environment;
import android.provider.Settings;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.multidex.MultiDex;

import com.huanzhu.asuper.supervisionapp.cjbjdudao.base.ServerManager;
import com.huanzhu.asuper.supervisionapp.cjbjdudao.uitls.AppApplicationContext;
import com.huanzhu.asuper.supervisionapp.cjbjdudao.uitls.FileUtils;
import com.huanzhu.asuper.supervisionapp.cjbjdudao.uitls.NetUtils;
import com.yanzhenjie.andserver.AndServer;
import com.yanzhenjie.andserver.Server;
import com.yanzhenjie.andserver.framework.website.AssetsWebsite;
import com.yanzhenjie.andserver.util.IOUtils;

import java.io.File;
import java.util.Locale;
import java.util.concurrent.TimeUnit;

/**
 * Created by wuaomall@gmail.com on 2018/7/12.
 */

public class WebApplication extends Application {

    public static WebApplication application;
    private File mRootDir;

    public static WebApplication getInstance() {
        if (application == null) {
            return new WebApplication();
        }
        return application;
    }


    @Override
    public void onCreate() {
        super.onCreate();
        AppApplicationContext.application = this;
        AppApplicationContext.context = getApplicationContext();
        MultiDex.install(this);
        init();

    }

    private  void init(){

    }

    @NonNull
    public File getRootDir() {
        return mRootDir;
    }

    private void initRootPath(Context context) {
        if (mRootDir != null) {
            return;
        }

        if (FileUtils.storageAvailable()) {
            mRootDir = Environment.getExternalStorageDirectory();
        } else {
            mRootDir = context.getFilesDir();
        }
        mRootDir = new File(mRootDir, "AndServer");
        IOUtils.createFolder(mRootDir);
    }



}
